package com.cino.demos.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cino.demos.entity.comment.Comment;
import com.cino.demos.mapper.comment.CommentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentService extends ServiceImpl<CommentMapper, Comment> {

    @Autowired
    private CommentMapper commentMapper;

    public List<Comment> commentList(){
        return commentMapper.list();
    }

    public Comment searchById(Integer id) {
        return commentMapper.selectById(id);
    }

    public void insert(Comment comment) {
//        common.setCreateTime(new DateTime());
//        common.setUpdateTime(new DateTime());
        commentMapper.insertEntity(comment);
    }

    public void update(Comment comment) {
//        common.setUpdateTime(new DateTime());
        commentMapper.update(comment);
    }

    public void deleteById(Integer id) {
        commentMapper.deleteById(id);
    }
}
